unit ImportPricesAdvancedGui;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls,

  inventionCalc, Region, ExtCtrls;

type
  TfrmImportPriceAdvanced = class(TForm)
    gbRegions: TGroupBox;
    rgSetting: TRadioGroup;
  private
    inventionCalc: TInventionCalc;
  public
    constructor Create(invCalc: TInventionCalc);
  end;

var
  frmImportPriceAdvanced: TfrmImportPriceAdvanced;

implementation

{$R *.dfm}

constructor TfrmImportPriceAdvanced.Create(invCalc: TInventionCalc);
var
  i: Integer;
  region: TRegion;
  checkbox: TCheckBox;
  top, left: Integer;
begin
  inventionCalc := invCalc;

  top := 16;
  left := 8;
  for i := 0 to inventionCalc.Regions.Count -1 do begin
    region := inventionCalc.Regions.GetRegion(i);
    checkbox := TCheckBox.Create(gbRegions);
    checkbox.Top := top;
    checkbox.Left := left;
    checkbox.Width := 113;
    checkbox.Parent := gbRegions;
    checkbox.Caption := region.Name;
    checkbox.Name := 'chkRegion_' + IntToStr(region.ID);
    top := top + 16;
    if (top > 300) then begin
      top := 16;
      left := left + 121;
    end;
  end;
end;

end.
